﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace NUnitTest.UnitTest.Targets
{
    [TestFixture]
    public class TestSetupCorrect
    {
        [SetUp]
        public void SetupTest()
        {
            setup = true;
        }
        private bool setup = false;

        [Test]
        public void HasBeenSetup()
        {
            Assert.IsTrue(setup);
            if (!setup)
            {
                throw new Exception("Test Crashed Because setup was not executed");
            }
            setup = false;
        }

        [Test]
        public void NotBeenSetupShouldFail()
        {
            Assert.IsFalse(setup);
            if (!setup)
            {
                throw new Exception("Test Crashed Because setup was not executed");
            }
            setup = false;
        }

        [TearDown]
        public void TearDownTest()
        {
            if (setup)
            {
                throw new Exception("Test Crashed Because tests were not executed");
            }
        }
    }
}
